<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Layui</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="layui/css/layui.css">
		<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
	</head>
	<body>

		<div style="margin:0 auto;width: 70%;">

			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
				<legend>设置提示文本</legend>
			</fieldset>

			<div id="slideTest6" class="demo-slider" style="margin-top: 40px;"></div>
			<div id="slideTest7" class="demo-slider" style="margin-top: 40px;"></div>
			<div id="test-slider-tips1" style="position:relative; left: 0px; top: 10px;"></div>

			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
				<legend>开启输入框</legend>
			</fieldset>

			<div id="slideTest8" class="demo-slider" style="margin-top: 40px;"></div>

			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
				<legend>开启范围选择</legend>
			</fieldset>

			<div id="slideTest9" class="demo-slider" style="margin-top: 40px;"></div>
			<div id="test-slider-tips2" style="position:relative; left: 0px; top: 10px;"></div>

			<div id="slideTest10" class="demo-slider" style="margin-top: 40px;"></div>

		</div>


		<script src="layui/layui.js" charset="utf-8"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
		<script>
			layui.use('slider', function() {
				var $ = layui.$,
					slider = layui.slider;

				//设置提示文本
				slider.render({
					elem: '#slideTest6',
					min: 20,
					max: 1000,
					setTips: function(value) { //自定义提示文本
						return value + 'GB';
					}
				});
				slider.render({
					elem: '#slideTest7',
					tips: false //关闭默认提示层
						,
					change: function(value) {
						$('#test-slider-tips1').html('当前数值：' + value);
					}
				});

				//开启输入框
				slider.render({
					elem: '#slideTest8',
					input: true //输入框
				});

				//开启范围选择
				slider.render({
					elem: '#slideTest9',
					value: 40 //初始值
						,
					range: true //范围选择
						,
					change: function(vals) {
						$('#test-slider-tips2').html('开始值：' + vals[0] + '、结尾值：' + vals[1]);
					}
				});
				slider.render({
					elem: '#slideTest10',
					value: [30, 60] //初始值
						,
					range: true //范围选择
				});


			});
		</script>

	</body>
</html>
